<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h2>Generator 管理异步</h2>
    <script>
        function *cityGenerator(){
            yield axios('http://hmajax.itheima.net/api/city?pname=北京')
            yield axios('http://hmajax.itheima.net/api/city?pname=广东')
        }
        // 获取 Generator对象
        const city=cityGenerator()

        city.next().then(res=>{
            console.log('res1',res);
            return city.next().value
        }).then(res=>{console.log('res',res)})

    </script>
</body>
</html>